﻿using System;
using System.Runtime.InteropServices;

namespace LED.Helper
{
    public struct Rect
    {
        public int Left;
        public int Top;
        public int Right;
        public int Bottom;
    } 
    public struct LEDBlock
    {
        public Int32 nStartX;  			/// 区域的开始X坐标
        public Int32 nStartY;				/// 区域的开始Y坐标
        public Int32 nWidth; 				/// 区域的宽度
        public Int32 nHeight;  			/// 区域的高度
    }
    public struct LEDFontDescriptor
    {
        public string szFontName;		 	/// 字体名称
        public Int32 lFontSize; 				/// 字体大小
        public Int32 lFontColor; 		/// 字体颜色
        public Int32 nBold; 				/// 是否粗体 0:正常 1:粗体
        public Int32 nStrick;    			/// 是否斜体 0:正常 1:斜体
        public Int32 nUnderline; 			/// 是否下划线 0:正常 1:下划线
    }
    public struct LEDClockDescriptor
    {
        Int32 nClockType;      /// 时钟类型 0:电子钟 1:圆形表盘时钟
        Int32 nShowFormat; 	/// 0:只显示年月日 1:只显示时分秒 2:0和1的组合，即显示年月日又显示分秒时
        Int32 nScaleColor; 			/// 表盘刻度线的颜色
        Int32 nBoundColor;			/// 表盘边框线颜色
        Int32 nHourColor; 			/// 表盘时针颜色
        Int32 nMinuteColor; 		/// 表盘分针颜色
        Int32 nSecondColor; 		/// 表盘秒针颜色
    }
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public struct SRECT
    {
        public Int16 left;
        public Int16 top;
        public Int16 right;
        public Int16 bottom;
    }
    [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)]
    public struct LPRECT
    {
        [FieldOffset(0)]
        public Int32 left;
        [FieldOffset(4)]
        public Int32 top;
        [FieldOffset(8)]
        public Int32 right;
        [FieldOffset(12)]
        public Int32 bottom;
    }
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public struct PDeviceParam
    {
        public int devType;
        public int Speed;
        public int ComPort;
        public int FlowCon;
        public int locPort;
        public int rmtPort;
        public int memory;
        [MarshalAs(UnmanagedType.I1, SizeConst = 32)]
        public byte Phone;
        [MarshalAs(UnmanagedType.I4, SizeConst = 5)]
        public int Reserved;
    }
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public struct LPSYSTEMTIME
    {
        Int32 wYear;
        Int32 wMonth;
        Int32 wDayOfWeek;
        Int32 wDay;
        Int32 wHour;
        Int32 wMinute;
        Int32 wSecond;
        Int32 wMilliseconds;
    }
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public struct PNotifyMessage
    {
        Int32 Message;
        Int32 Command;
        Int32 Result;
        Int32 Status;
        Int32 Address;
        Int32 Size;
        string Buffer;
        PDeviceParam param;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
        public char Host;
        Int32 port;
    }

    public static partial class LEDHelper
    {
        public const int WM_WINDOWPOSCHANGED = 0x0047;
        public const int WM_WINDOWPOSCHANGING = 0x0046;
        public const int WM_NCMOUSEMOVE = 0xa0;
        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int WM_NCLBUTTONUP = 0xA2;
        public const int WM_NCLBUTTONDBLCLK = 0xA3;
        public const int WM_NCRBUTTONDOWN = 0xA4;
        public const int WM_NCRBUTTONUP = 0xA5;
        public const int WM_CAPTURECHANGED = 0x0215;
        public const int WM_EXITSIZEMOVE = 0x0232;
        public const int WM_ENTERSIZEMOVE = 0x0231;
        public const int WM_MOVE = 0x0003;
        public const int WM_MOVING = 0x0216;
        public const int WM_KILLFOCUS = 0x0008;
        public const int WM_SETFOCUS = 0x0007;
        public const int WM_ACTIVATE = 0x0006;
        public const int WM_NCHITTEST = 0x0084;

        public const int WA_INACTIVE = 0x0000;
    }
}
